﻿@model TumbaloSoft.Helpers.QueryObjects.BusquedaInmueble
@{
	Layout = "~/Views/Shared/_HomeLayout.cshtml";
	ViewBag.Title = "Catalogo de Inmuebles";
}
<script>
	function siguientePagina() {
		var form = document.getElementById("ContactForm");
		var prPage = document.createElement("div");
		prPage.innerHTML = "<input type='hidden' value='@ViewBag.nextPage' id='prPage' name='prPage'>";
		document.getElementById("ContactForm").appendChild(prPage);
		document.getElementById("ContactForm").submit();
	}
	function anteriorPagina() {
		var form = document.getElementById("ContactForm");
		var prPage = document.createElement("div");
		prPage.innerHTML = "<input type='hidden' value='@ViewBag.prevPage' id='prPage' name='prPage'>";
		document.getElementById("ContactForm").appendChild(prPage);
		document.getElementById("ContactForm").submit();
	}
</script>
	<div class="body2" style="margin-bottom: 0px;">
		<div class="main">
			<section id="content">
				<div class="wrapper">
					
					<form id="ContactForm" method="post">
								<div class="wrapper">	
									<h3 style="padding-top: 0px; padding-bottom: 10px;">Busqueda de Inmueble
									<a id="buscar"><img src="../Content/site/images/icono_buscar.png" /></a>
									</h3>
									
									<table border="0" id="indice" >
										<tr>
											<th>ID</th>
											<th>Direccion</th>
											<th>Estado</th>
											<th>Tipo</th>
											<th>Distrito</th>
                                            <th>Moneda</th>
											<th>Precio</th>
											<th>Imagen</th>
											
										</tr>
										@foreach (var inmueble in ViewBag.ListaInmueble)
		                                {
											<tr class="alt">
												<td>@inmueble.prIdInmueble</td>
												<td>@inmueble.prDireccion</td>
												<td>@inmueble.prEstado</td>

												<td>
													@foreach (var objTipo1 in ViewBag.listaTipoInmueble)
		                                            {
			                                            if (@objTipo1.prIdTipoInmueble == @inmueble.prTipoInmueble.prIdTipoInmueble)
			                                            {
														@objTipo1.prDescripcion
			                                            }
		                                            }
												</td>

												<td>
													@foreach (var objTipo2 in ViewBag.listaDistritos)
		                                            {
			                                            if (@objTipo2.prIdDistrito == @inmueble.prDistrito.prIdDistrito)
			                                            {
														@objTipo2.prNombreDistrito
			                                            }
		                                            }
												</td>

                                                <td>
                                                    @foreach (var obj in ViewBag.Monedas)
                                                    {
                                                        if (obj.prIdMoneda == @inmueble.prMoneda.prIdMoneda)
                                                        {
                                                            @obj.prDescripcion;
                                                        }
                                                    }
                                                </td>

												
												<td>@inmueble.prValorMercado</td>
												<td ><a  href="/Home/InmuebleDetalles?prIdInmueble=@inmueble.prIdInmueble"><img src="@inmueble.prImagen" style="height: 100px; width: 160px;"/></a></td>
												
											</tr>
		                                }
									</table>

								</div>
							</form>
				</div>
				  <span style="float: none; margin-left: 29px;">
							@if (ViewBag.prevPage > 0)
	                        {
								<a href="javascript:anteriorPagina()"><img  src="../Content/site/images/icono_anterior.png" /></a> 
	                        }
							 
                                        @if (ViewBag.nextPage <= ViewBag.numPages)
								{
									<a href="javascript:siguientePagina()"><img src="../Content/site/images/icono_siguiente.png" /></a>
								}
						</span>
			</section>
		</div>
	</div>

	<!-- / content -->

	<script type="text/javascript"> Cufon.now(); </script>
	<script type="text/javascript">
		$(window).load(function () {
			$('#slider').nivoSlider({
				effect: 'sliceUpDown', //Specify sets like: 'fold,fade,sliceDown, sliceDownLeft, sliceUp, sliceUpLeft, sliceUpDown, sliceUpDownLeft'
				slices: 17,
				animSpeed: 500,
				pauseTime: 6000,
				startSlide: 0, //Set starting Slide (0 index)
				directionNav: false, //Next & Prev
				directionNavHide: false, //Only show on hover
				controlNav: true, //1,2,3...
				controlNavThumbs: false, //Use thumbnails for Control Nav
				controlNavThumbsFromRel: false, //Use image rel for thumbs
				controlNavThumbsSearch: '.jpg', //Replace this with...
				controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
				keyboardNav: true, //Use left & right arrows
				pauseOnHover: true, //Stop animation while hovering
				manualAdvance: false, //Force manual transitions
				captionOpacity: 1, //Universal caption opacity
				beforeChange: function () { $('.nivo-caption').animate({ bottom: '-110' }, 400, 'easeInBack') },
				afterChange: function () { Cufon.refresh(); $('.nivo-caption').animate({ bottom: '-20' }, 400, 'easeOutBack') },
				slideshowEnd: function () { } //Triggers after all slides have been shown
			});
			Cufon.refresh();
		});
	</script>
